package com.thf.service.impl;

import com.thf.dao.impl.CompanyDaoImpl;
import com.thf.model.CompanyModels;
import com.thf.service.CompanyService;
import com.thf.util.FileDataUtil;

import java.io.IOException;

public class CompanyServiceImpl implements CompanyService {
    CompanyDaoImpl cdi =new CompanyDaoImpl();

    @Override
    public String[] getCompanyData(String inPath, String outPath, String pathName) {
        String filePath = cdi.createFileData(inPath,outPath,pathName);
        String[] fileData = null ;
        try {
            fileData = FileDataUtil.getFileData(filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return fileData ;
    }

    @Override
    public CompanyModels setCompanyData() {
        CompanyModels companyModels = new CompanyModels();
        String[] companyData = getCompanyData("D:/test/companyTitleData.txt", "D:\\huarui03\\web\\WEB-INF\\note", "companyTitleData.txt");
        companyModels.setTitleOne(companyData[0]);
        companyModels.setTitleTwo(companyData[1]);
        companyModels.setTitleThere(companyData[2]);
        companyModels.setTitleFour(companyData[3]);
        companyModels.setTitleFive(companyData[4]);
        return companyModels;
    }
}
